﻿
@{
    ViewBag.Title = "showtype";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
@section Header{
    <link href="~/Asset/font-awesome-4.6.3/css/font-awesome.min.css" rel="stylesheet" />
    <script src="~/Asset/esimakin-twbs-pagination/jquery.twbsPagination.min.js"></script>
}
<script>
    $(document).ready(function () {
        $.ajax({
                type:"get",
                url: "/hystype/showall",
                success: function (data) {
                    $(data).each(function (i, obj) {
                        var tr = "<tr><td>" + obj.Id + "</td><td>" + obj.PhysicalName + "</td> <td style='width:10%;'><div class='btn-group'><a href='#' class='btn btn-default btn-sm'>管理</a> <a href='#' type='button' class='btn btn-default btn-sm dropdown-toggle' data-toggle='dropdown' aria-expanded='false'><span class='caret'></span> </a><ul class='dropdown-menu'><li><a class='hospital_edit' href='#' data-id=''+obj.Id+''>编辑</a></li><li><a href='#' onclick='return confirm(\"确定要删除吗？\")'>删除</a></li> </ul></div></td></tr>";
                        $("#type-table tbody").append(tr);
                    })
                }

        })
    //添加体检类型
        $("#btn_add_leixing").click(function () {
            var typename = $("#Name").val();
           $.ajax({
               type:"get",
               url: "/Hystype/add",
               data:{
                   "Pname":typename
               },
               success: function (data) {
                   if (data > 0)
                   { 
                       alert("添加成功");
                       location.href="/zhinanxiang/showtype";
                   }
                   else
                   {    
                       alert("添加失败");
                   }
               }
           })
        })
    })
</script>
<div class="content">
    <div class="modal fade" id="modal_add_leixing" tabindex="-1" role="dialog" aria-labelledby="label_course">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title" id="label_course"><strong>添加类型</strong></h4>
                </div>
                <div class="modal-body">
                    <div class="row form-group">
                        <div class="col-md-3 control-label">
                            <label for="Name" class="pull-right">体检类型名称</label>
                        </div>

                        <div class="col-md-7 controls">
                            <input id="Name" class="form-control" type="text">
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <div id="doing" style="float:left;display:none;">
                        <i class="fa fa-circle-o-notch fa-spin"></i><span> 处理中...</span>
                    </div>
                    <div id="success" style="float: left; display: none; ">
                        <i class="fa fa-check-square"></i><span> 保存成功！</span>
                    </div>
                    <div id="error" style="float: left; display: none; ">
                        <i class="fa fa-warning"></i><span> 保存失败！</span>
                    </div>

                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button id="btn_add_leixing" type="button" class="btn btn-primary">提交</button>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-2">
            <div class="list-group">
                <a href="@Url.Action("Index", "zhinanxiang")" class="list-group-item active">体检指南管理</a>
                <a href="@Url.Action("showtype", "zhinanxiang")" class="list-group-item ">体检指南类型管理</a>
                <a href="@Url.Action("", "zhinanxiang")" class="list-group-item">内容管理</a>
            </div>
        </div>
        <div class="col-md-10">
            <div class="page-header clearfix" style="padding:10px;">
                <h4 class="pull-left">体检类型管理</h4>
                <!--操作按钮-->
                <div class="pull-right">
                    <a class="btn btn-success btn-sm" data-toggle="modal" data-target="#modal_add_leixing">添加体检类型</a>
                </div>
            </div>

            <!--内容区域-->
            @*<form id="user-search-form" class="form-inline well well-sm" action="/Exam/QueryExam" method="post" novalidate="">
                    <div class="form-group">
                        <input type="text" id="keyword" name="ExamName" class="form-control" value="" placeholder="添加相关词">
                    </div>
                    <button class="btn btn-primary" type="submit">搜索</button>
                </form>*@

            <table id="type-table" class="table table-striped table-hover" data-search-form="#user-search-form">
                <thead>
                    <tr>
                        <th>编号</th>
                        <th>类型名称</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>

            <!--分页-->
            <nav class=" text-center">
                <ul id="pagination" class="pagination-sm"></ul>
            </nav>
        </div>
    </div>
</div>





